﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RayDen.MaterialManager
{
    public static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (var mainAppForm = new EditorForm())
            {
                Application.Idle += mainAppForm.OnIdle;
                Application.ThreadException += ApplicationOnThreadException;
                Application.Run(mainAppForm);
            }
        }

        private static void ApplicationOnThreadException(object sender, ThreadExceptionEventArgs threadExceptionEventArgs)
        {
            MessageBox.Show(threadExceptionEventArgs.Exception.Message, "Exception", MessageBoxButtons.OK,
                            MessageBoxIcon.Error);
        }
    }
}
